package com.ms.p2p.provider.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.ms.p2p.bean.PageBean;
import com.ms.p2p.entity.loan.Loan;
import com.ms.p2p.entity.loan.LoanImg;
import com.ms.p2p.entity.loan.LoanTenderRecord;
import com.ms.p2p.entity.member.Member;
import com.ms.p2p.entity.system.AdminUser;
import com.ms.p2p.provider.LoanProvider;
import com.ms.p2p.service.impl.LoanServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * Created by daimajia on 2015/4/19 添加dubbo接口.
 */
@Service
public class LoanProviderImpl implements LoanProvider {
    @Autowired
    LoanServiceImpl loanService;

    public void successLoan(Loan borrow, List<LoanTenderRecord> borrowTenderList, String ip) {
        loanService.successLoan(borrow,borrowTenderList,ip);
    }

    public void awardForTender(Loan loan, List<LoanTenderRecord> tenderList, String ip) {
        loanService.awardForTender(loan,tenderList,ip);
    }

    public int overBorrow(Loan loan) {
        return loanService.overBorrow(loan);
    }

    public int tender(BigDecimal successAmount, Integer id) {
        return loanService.tender(successAmount,id);
    }

    public int insert(Loan loan) {
        return loanService.insert(loan);
    }

    public List<Map<String, Object>> findPager(String borrowId, String userName, Integer userId, Integer borrowType, Integer borrowStatus, Integer timeLimitBegin, Integer timeLimitEnd, Integer aprBegin, Integer aprEnd, Integer lowestAccountBegin, Integer lowestAccountEnd, Integer borrowStyle, String begin_time, String end_time, PageBean borrowPage) {
        return loanService.findPager(borrowId,userName,userId,borrowType,borrowStatus,timeLimitBegin,timeLimitEnd,aprBegin,aprEnd,lowestAccountBegin,lowestAccountEnd,borrowStyle,begin_time,end_time,borrowPage);
    }

    public Integer findCount(String borrowId, String userName, Integer userId, Integer borrowType, Integer borrowStatus, Integer timeLimitBegin, Integer timeLimitEnd, Integer aprBegin, Integer aprEnd, Integer lowestAccountBegin, Integer lowestAccountEnd, Integer borrowStyle, String begin_time, String end_time) {
        return loanService.findCount(borrowId,userName,userId,borrowType,borrowStatus,timeLimitBegin,timeLimitEnd,aprBegin,aprEnd,lowestAccountBegin,lowestAccountEnd,borrowStyle,begin_time,end_time);
    }

    public Loan findById(String id) {
        return loanService.findById(id);
    }

    public int update(Loan loan) {
        return loanService.update(loan);
    }

    public Integer count(String userId, String status) {

          return  loanService.count(userId,status);

    }

    public int updateOptimistic(Loan loan) {
        return loanService.updateOptimistic(loan);
    }

    public int insertImg(LoanImg img) {
        return loanService.insertImg(img);
    }

    public List<LoanImg> findImgByBorrowId(Integer borrow_id) {
        return loanService.findImgByBorrowId(borrow_id);
    }

    public int delImgByBorrowId(Integer borrow_id) {
        return loanService.delImgByBorrowId(borrow_id);
    }

    public  void calculateFailBid(String ip, Loan borrow) {
        loanService.calculateFailBid(ip,borrow);
    }

    public Map<String, Object> totalMoney() {
        return loanService.totalMoney();
    }

    public void addStay(Loan loan,String ip) {
        loanService.addStay(loan,ip);
    }

    public void addDueRecord(Loan loan,String ip) {
        loanService.addDueRecord(loan, ip);
    }

    public Loan findCommend() {
        return loanService.findCommend();
    }

    public void doTender(BigDecimal successAmount, Loan borrow, Member user, double account, String remoteIp, String packet_id) {
        loanService.doTender(successAmount,borrow,user,account,remoteIp,packet_id);
    }

    public void verify(Loan loan, String status, AdminUser emp, String remark, String ip) {
        loanService.verify(loan,status,emp,remark,ip);
    }

    public void full_cancel(Loan borrow, AdminUser user, String ip) {
        loanService.full_cancel(borrow,user,ip);
    }

    public void loan_cancel(Loan borrow, AdminUser user, String ip) {
        loanService.loan_cancel(borrow,user,ip);
    }

    public Loan findRookie() {
        return loanService.findRookie();
    }

}
